﻿namespace Vibstudio.NetConfigurator.Globalization
{
    using System.Collections.Generic;
    using System.Text;

    internal class EnglishLabeler : ILabeler
    {
        public Label BackupFiles
        {
            get { return Label.Create("Backup files?"); }
        }

        public Label ApplicationsFile
        {
            get { return Label.Create("Application file"); }
        }

        public Label ConfigurationsFile
        {
            get { return Label.Create("Configuration file"); }
        }

        public Label ConfigurationFile
        {
            get { return Label.Create("Configuration file"); }
        }

        public Label ChooseApplicationsPathToConfigure
        {
            get { return Label.Create("Choose the base path of the applications to configure"); }
        }

        public Label ChooseApplicationsPathToCompose
        {
            get { return Label.Create("Choose the base path of the applications to compose"); }
        }

        public Label ChooseApplicationsPathToAutoCompose
        {
            get { return Label.Create("Choose the base path of the applications to automatically compose"); }
        }

        public Label RunConfiguration
        {
            get { return Label.Create("Runs configuration"); }
        }

        public Label RunComposition
        {
            get { return Label.Create("Runs composition"); }
        }

        public Label GoToHome
        {
            get { return Label.Create("Go to home page"); }
        }

        public Label ValidateUrl
        {
            get { return Label.Create("Validate URLs"); }
        }

        public Label Application
        {
            get { return Label.Create("Application"); }
        }

        public Label Configuration
        {
            get { return Label.Create("Configuration"); }
        }

        public Label Composition
        {
            get { return Label.Create("Composition"); }
        }

        public Label Outcome
        {
            get { return Label.Create("Outcome"); }
        }

        public Label Message
        {
            get { return Label.Create("Message"); }
        }

        public Label Url
        {
            get { return Label.Create("URL"); }
        }

        public Label ConfigurationMode
        {
            get { return Label.Create("Configuration mode"); }
        }

        public Label CompositionMode
        {
            get { return Label.Create("Composition mode"); }
        }

        public Label InvalidURI
        {
            get { return Label.Create("Invalid URI"); }
        }

        public Label RunAutoComposition
        {
            get { return Label.Create("Run automatic composition"); }
        }

        public Label SuccessfulConfiguration
        {
            get { return Label.Create("Configuration completed successfully"); }
        }

        public Label SuccessfulComposition
        {
            get { return Label.Create("Composition completed successfully"); }
        }

        public Label SuccessfulValidation
        {
            get { return Label.Create("Validation completed successfully"); }
        }

        public Label PartialConfiguration(int percentage)
        {
            return Label.Create(string.Format("Configuration partially performed ({0}%)", percentage));
        }

        public Label PartialComposition(int percentage)
        {
            return Label.Create(string.Format("Composition partially performed ({0}%)", percentage));
        }

        public Label PartialValidaton(int percentage)
        {
            return Label.Create(string.Format("Validation partially performed ({0}%)", percentage));
        }

        public Label ConfigurationNotPerformed
        {
            get { return Label.Create("Configuration not performed"); }
        }

        public Label CompositionNotPerformed
        {
            get { return Label.Create("Composition not performed"); }
        }

        public Label ValidationNotPerformed
        {
            get { return Label.Create("Validation not performed"); }
        }

        public Label OperationNotExecutable
        {
            get { return Label.Create("Operation not executable"); }
        }

        public Label DirectoryNotFound
        {
            get { return Label.Create("Directory not found"); }
        }

        public Label FileNotFound(string fullPath)
        {
            return Label.Create(string.Format("File not found '{0}'", fullPath));
        }

        public Label FileNotFoundInDirectory()
        {
            return Label.Create("File not found in specified directory");
        }

        public Label FileNotFoundInDirectory(string path)
        {
            return Label.Create(string.Format(@"File not found in specified directory ({0})",
                                              path));
        }

        public Label FileNotFoundInDirectory(string file, string path)
        {
            return Label.Create(string.Format(@"File not found ({0}) in specified directory ({1})",
                                              file,
                                              path));
        }

        public Label FileNotFoundInDirectory(string file, string rootPath, string folderName)
        {
            return Label.Create(string.Format(@"File not found ({0}) in specified directory ({1}\...\{2})",
                                              file,
                                              rootPath,
                                              folderName));
        }

        public Label FirstFileConfiguredSuccessfully(string path, int count)
        {
            return Label.Create(string.Format(@"'{0}', first of {1} found, configured successfully",
                                              path,
                                              count));
        }

        public Label UnknownConfigurator(string configuratorName)
        {
            return
                Label.Create(string.Format("Configurator{0} unknown",
                                           string.IsNullOrEmpty(configuratorName)
                                               ? string.Empty
                                               : string.Format(" \"{0}\"", configuratorName)));
        }

        public Label UnknownComposer(string composerName)
        {
            return Label.Create(string.Format("Composer{0} unknown",
                                           string.IsNullOrEmpty(composerName)
                                               ? string.Empty
                                               : string.Format(" \"{0}\"", composerName)));
        }

        public Label AutocompositionAlreadyPerformed(string compositionName)
        {
            return Label.Create(string.Format("Composition{0} already performed",
                                              string.IsNullOrEmpty(compositionName)
                                              ? string.Empty
                                              : string.Format(" \"{0}\"", compositionName)));
        }

        public Label ApplicationNotReference(string applicationName = "")
        {
            return Label.Create(string.Format("The application{0} is not that of reference",
                                              string.IsNullOrEmpty(applicationName)
                                                  ? string.Empty
                                                  : string.Format(" \"{0}\"", applicationName)));
        }

        public Label CompositionPartiallyPerformed(IEnumerable<string> unconfiguredSettings)
        {
            var labelBuilder = new StringBuilder();

            labelBuilder.Append("Setting keys missing:");
            foreach (string setting in unconfiguredSettings)
            {
                labelBuilder.AppendFormat(" {0},", setting);
            }
            labelBuilder.Remove(labelBuilder.Length - 1, 1);

            return Label.Create(labelBuilder);
        }

        public Label BasePathNotSpecified
        {
            get { return Label.Create("Root path of applications to be configured not specified"); }
        }
    }
}
